package com.supermali.system;

import com.supermali.creater.GameStarter;
import com.supermali.util.FrameRate;

import java.awt.*;

/**
 * 加载系统界面
 * */
public class LoadingSystem extends AbstractSystem {
    // 3秒钟后，自动转成运行状态
    int totalTime = 0;


    public LoadingSystem(GameStarter gameStarter,SystemHelper systemHelper) {
        super(gameStarter,systemHelper);
    }

    @Override
    public void exec(Graphics g, FrameRate frameRate) {
        createLoadingImg(g,frameRate.getDiff());
    }

    /**
     * 创建Loading界面的展示
     * */
    private void createLoadingImg(Graphics g,long delta){
        gameStarter.show(g,delta);
        // 显示文本
        ShowLabel.showStr(g,"WORLD 1-1",13*16, 10*16);
        ShowLabel.showStr(g," * 3",14*16, 8*16);
        totalTime+=delta;
        if(totalTime>3000){
            systemHelper.setSystemStatus(SystemStatus.RUNNING);
        }
    }
}
